package professor.aula10.com.fafica.telas;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class telaExemplo1 {

	private JFrame frame;
	private JTextField textNome;
	private JTextField textCPF;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					telaExemplo1 window = new telaExemplo1();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public telaExemplo1() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 503, 338);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
		
		JButton btnCaralho = new JButton("Cadastrar");
		btnCaralho.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				cadastrar();
			}
		});
		btnCaralho.setBounds(26, 152, 89, 23);
		frame.getContentPane().add(btnCaralho);
		
		JLabel lblNome = new JLabel("Nome:");
		lblNome.setBounds(78, 52, 46, 14);
		frame.getContentPane().add(lblNome);
		
		textNome = new JTextField();
		textNome.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			}
		});
		textNome.setBounds(139, 49, 242, 20);
		frame.getContentPane().add(textNome);
		textNome.setColumns(10);
		
		JLabel lblCpf = new JLabel("CPF:");
		lblCpf.setBounds(78, 78, 46, 14);
		frame.getContentPane().add(lblCpf);
		
		textCPF = new JTextField();
		textCPF.setText("");
		textCPF.setBounds(139, 75, 242, 20);
		frame.getContentPane().add(textCPF);
		textCPF.setColumns(10);
		
		JButton btnRemover = new JButton("Remover");
		btnRemover.setBounds(141, 152, 89, 23);
		frame.getContentPane().add(btnRemover);
		
		JButton btnAlterar = new JButton("Alterar");
		btnAlterar.setBounds(256, 152, 89, 23);
		frame.getContentPane().add(btnAlterar);
		
		JButton btnListar = new JButton("Listar");
		btnListar.setBounds(371, 152, 89, 23);
		frame.getContentPane().add(btnListar);
	}
	
	private void cadastrar(){
		JOptionPane.showMessageDialog(frame, textNome.getText());
		textNome.setText("");
	}
	
	private void remover(){
		
	}
	
	private void alterar(){
		
	}
	
	private void listar(){
		
	}
}
